@@ -11,10 +11,12 @@ gem 'rturk', '~> 2.12.1' # HumanTaskAgent |
||
| 11 | 11 |
gem 'weibo_2', '~> 0.1.4' # Weibo Agents |
| 12 | 12 |
gem 'hipchat', '~> 1.2.0' # HipchatAgent |
| 13 | 13 |
gem 'xmpp4r', '~> 0.5.6' # JabberAgent |
| 14 |
-gem "google-api-client" # GoogleCalendarPublishAgent |
|
| 15 | 14 |
gem 'mqtt' # MQTTAgent |
| 16 | 15 |
gem 'slack-notifier', '~> 0.5.0' # SlackAgent |
| 17 | 16 |
|
| 17 |
+# GoogleCalendarPublishAgent |
|
| 18 |
+gem "google-api-client", require: 'google/api_client' |
|
| 19 |
+ |
|
| 18 | 20 |
# Twitter Agents |
| 19 | 21 |
gem 'twitter', '~> 5.8.0' # Must to be loaded before cantino-twitter-stream. |
| 20 | 22 |
gem 'cantino-twitter-stream', github: 'cantino/twitter-stream', branch: 'master' |
@@ -4,7 +4,7 @@ module Agents |
||
| 4 | 4 |
class GoogleCalendarPublishAgent < Agent |
| 5 | 5 |
cannot_be_scheduled! |
| 6 | 6 |
|
| 7 |
- gem_dependency_check { defined?(GoogleCalendar) }
|
|
| 7 |
+ gem_dependency_check { defined?(Google) && defined?(Google::APIClient) }
|
|
| 8 | 8 |
|
| 9 | 9 |
description <<-MD |
| 10 | 10 |
#{'## Include `google-api-client` in your Gemfile to use this Agent!' if dependencies_missing?}
|
@@ -1,7 +1,4 @@ |
||
| 1 |
-require "google/api_client" |
|
| 2 |
- |
|
| 3 | 1 |
class GoogleCalendar |
| 4 |
- |
|
| 5 | 2 |
def initialize(config, logger) |
| 6 | 3 |
@config = config |
| 7 | 4 |
@key = Google::APIClient::PKCS12.load_key(@config['google']['key_file'], @config['google']['key_secret']) |
@@ -63,5 +60,4 @@ class GoogleCalendar |
||
| 63 | 60 |
@logger.debug ret.to_yaml |
| 64 | 61 |
ret |
| 65 | 62 |
end |
| 66 |
- |
|
| 67 | 63 |
end |